;   calculate delta point
;
CALCDEL  txa                            ;make sure of 0-7
         and      #$07
         tax
         lda      RELSPOLD,X            ;get old RELSPAV value
         sub      RELSPAV               ;subtract
         pha
         lda      RELSPOLD+8,X          ;subtract high byte
         sbc      RELSPAV+1
         pla                            ;restore value from stack
         bge      >2                    ;going down -- bad
         lda      #0                    ;going up -- just return 0
^2       rts      
;
;
;   check for DELTA limit exceeded
;
CHKDELIM sta      P1R16                 ;save delta to check
         lda      #0
         sta      P1R16+1
         sta      P3R16+1
         lda      RELSPAV0+1            ;make sure <256
         beq      >2
         lda      #255                  ;no, max at 255
         /HIDE2
^2       lda      RELSPAV0
         sta      P3R16                 ;save for multiply
         jsr      MULTR16               ;get threshold value
;
         lda      DELRELSP,X            ;index into DELTA values
         cmp      P1R16+1               ;check against N*RELSPAV0
         rts                            ;carry set on error
